<!DOCTYPE html>
<?php require dirname(dirname(__FILE__)) . '/view/checkuser.php';?>
<html>
<head>
<meta charset="UTF-8">
<title>188对比 - 模型列表</title>
<link rel="stylesheet" type="text/css" href="../include/css/base.css" />
<style>
td {height: 22px;}
</style>
</head>
<body>
<?php 
require dirname(dirname(__FILE__)) . '/include/conf.php';
require dirname(dirname(__FILE__)) . '/include/basefunc.php';
require dirname(dirname(__FILE__)) . '/include/database.php';

$db = db_touzhu();
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
	foreach ($_POST as $_key => $one){
		if (!is_numeric($one)){
			continue;
		}
		@list($_postitem, $_id) = explode('_', $_key);
		if ($_postitem == 'betmoeny' && is_numeric($_id) && $_id > 0){
			$sql_up = "update bet_model set bet_money={$one} where id={$_id}";
			$db->query($sql_up);
		}
	}
	exit('成功！<a href="/view/bet_model.php">返回</a>');
}

$sql = "select id, number, `describe`, conclusion, bet_money, add_time, `status` from bet_model where status=0 order by id";
$re = $db->query($sql);
?>

<form method="post">
<table class="tableunify" style="width: 1000px;">
	<thead>
		<tr>
			<th>序号</th>
			<th>模型描述</th>
			<th>结论</th>
			<th>金额</th>
			<th>修改金额</th>
		</tr>
	</thead>
	<tbody>
		<?php if ($re){
		foreach ($re as $model){?>
		<tr>
			<td><?php echo $model['number']?></td>
			<td><?php echo $model['describe']?></td>
			<td style="color: green;"><?php echo $model['conclusion']?></td>
			<td><?php echo $model['bet_money']?></td>
			<td><input type="text" name="betmoeny_<?php echo $model['id']?>" size="1"></td>
		</tr>
		<?php }}else{?>
		<tr><td colspan="5" style="text-align:center;">NO</td></tr>
		<?php }?>
		<tfoot>
			<tr><th class="paging" colspan="5"><input type="submit" value=" 保 存 " /></th></tr>
		</tfoot>
	</tbody>
</table>
</form>

</body>
</html>